package com.niit.users.pojo;

import java.util.Date;

import lombok.Data;

/**
 * 管理员Pojo
 * 
 * @author DELL
 *
 */
@Data
public class TbOrder {
    private int orderId;
    private int orderStatus;
    private Date orderCreationTime;
    private int busId;
    private int passengerId;
    private int timetableId;
    private String rideDate;
    private int seatNo;
    
    private String orderStatusStr;
    
    /**
     * 获取订单状态
     * @return
     */
    public String getOrderStatusStr() {
        // 根据状态值获取字符串描述
        TbOrderEnum[] enums = TbOrderEnum.values();
        for (int i = 0; i < enums.length; i++) {
            TbOrderEnum enumTemp = enums[i];
            if (enumTemp.toString().startsWith("ORDERSTATUS_")) {
                // 表示是状态的标识
                if (enumTemp.getStatus() == this.getOrderStatus()) {
                    this.orderStatusStr = enumTemp.getName();
                    break;
                }
            }
        }
        return orderStatusStr;
    }
    
    public void printTitle() {
        String splitStr = "\t\t";
        StringBuffer sb = new StringBuffer();
        sb.append("订单Id").append(splitStr);
        sb.append("订单状态").append(splitStr);
        sb.append("创建时间").append(splitStr);
        sb.append("巴士Id").append(splitStr);
        sb.append("乘客Id").append(splitStr);
        sb.append("班次Id").append(splitStr);
        sb.append("乘车日期").append(splitStr);
        sb.append("座位号").append(splitStr);
        System.out.println(sb.toString());
    }
    
    public void printInfo() {
        String splitStr = "\t\t";
        StringBuffer sb = new StringBuffer();
        sb.append(orderId).append(splitStr);
        sb.append(this.getOrderStatusStr()).append(splitStr);
        sb.append(orderCreationTime).append(splitStr);
        sb.append(busId).append(splitStr);
        sb.append(passengerId).append(splitStr);
        sb.append(timetableId).append(splitStr);
        sb.append(rideDate).append(splitStr);
        sb.append(seatNo).append(splitStr);
        System.out.println(sb.toString());
    }
    
    public void printInput() {
        String splitStr = ";";
        StringBuffer sb = new StringBuffer();
        sb.append(passengerId).append(splitStr);
        sb.append(busId).append(splitStr);
        sb.append(timetableId).append(splitStr);
        sb.append(rideDate).append(splitStr);
        sb.append(seatNo).append(splitStr);
        System.out.println("详情信息(输入模板):" + sb.toString());
    }
}
